export default class DiscSong {
  constructor ({id, mid, singer, name, album, interval, img, url}) {
    this.id = id
    this.mid = mid
    this.singer = singer
    this.name = name
    this.album = album
    this.interval = interval
    this.img = img
    this.url = url
  }
}

export function createDiscSong (musicData) {
  return new DiscSong({
    id: musicData.id,
    mid: musicData.mid,
    singer: filterSinger(musicData.singer),
    name: musicData.name,
    album: musicData.album.name,
    interval: musicData.interval,
    img: `https://p.qpic.cn/music_cover/IzXLVU2LmHt6bQg7vXk0uoDC1hpKlaib97uTT6IUp8ib19ELgSne3WNA/300?n=1`
  })
}
function filterSinger (singer) {
  let ret = []
  if (!singer) return
  singer.forEach((item) => {
    ret.push(item.name)
  })
  return ret.join('/')
}
